home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGSCAL / XGRAPH.LZH / READ.ME < prev    next >
Text File  |  1987-03-23  |  16KB  |  372 lines

  1. This file describes the other files present on the disk, the functions
  2. supported by the XGRAPH routines (version 02.02) and the parameters needed
  3. by each function.
  4.  
  5. The XGRAPH routines are a set of functions intended to work on all
  6. IBM video adapters with graphics capabilities. Enough functions are provided
  7. to effectively use the graphic capabilities of the video adapters. The video 
  8. adapters currently supported are IBM-CGA, IBM-EGA, and HP-Multimode. The 
  9. Hercules and other video adapters can also be used by modifying
  10. the appropiate entries in the tables returned by the function VideoInit.
  11.  
  12.  
  13. These routines are released for Non-Commercial use only and the author reserves
  14. all commercial rights and uses. Any sugestions, questions or comments should be
  15. send to the address below:
  16.  
  17.                 Abe Achkinazi                 
  18.                 6211 Home ave
  19.                 Bell, CA 90201
  20.  
  21. I am particularly interested in hearing about any bugs found, possible
  22. extensions to support other video adapters (Hercules, ATT etc) and what other
  23. functions should be implemented.
  24.  
  25. If you like these routines a donations of $10.00 will help the author to
  26. continue supporting them.
  27.  
  28. -------------------------------------------------------------------------------
  29.  
  30. Files included in this release:
  31.  
  32. Read.me   :     This file.
  33.  
  34. Xgraph.exe:     Executable file that installs the extended graphic routines.
  35.                 It installs a stay resident program and takes about 13K of
  36.                 RAM. The file must be executed only one time before any of the 
  37.                 example programs are executed.
  38.  
  39. Weaver.com:     Example demostrating the rectangle filling capabilities.
  40.  
  41. Zoo2.com:       Example of line drawing capabilities.
  42.  
  43. SmplXgrf.com:   A simple user interface to the XGRAPH's routines. The program
  44.                 can be used to play with the different built-in functions
  45.                 without having to write a program.
  46.  
  47. Xgraph.pas:     Include file for those programs written in Turbo-Pascal that
  48.                 want to use the XGRAPH routines. This file is include in the
  49.                 source programs below.
  50.  
  51. Weaver.pas:     Source code for Weaver program above.
  52.  
  53. Zoo2.pas:       Source code for Zoo2.com program above.
  54.  
  55. SmplXgrf.pas:   Source code for SmplXgrf.com program above.
  56.  
  57. DoAll.bat:      One batch file to install the XGRAPH functions and execute the
  58.                 example programs in CGA mode 6. But try other modes on your own. 
  59.  
  60. -------------------------------------------------------------------------------
  61.  
  62. Remember that XGRAPH.EXE stays around in memory after it is executed and looks
  63. at all the INT 10H functions. If the function is one of those below it will be
  64. handled by XGRAPH, otherwise it is passed to the normal INT 10H handler.
  65.  
  66. List of functions supported (ordered by function number in AH register and
  67. called by issuing and INT 10H):
  68.  
  69. 0A3H -  VidID, returns major and minor version number of XGRAPH routines
  70.         installed.
  71.  
  72. 0A4H -  VidInit, figure out the raster type and return information
  73.         to caller. Initialize internal variables.
  74.  
  75. 0A5H -  VidClear, clear the graphics display.
  76.  
  77. 0A6H -  VidRectFill, fill rectangular area of the display with a pattern.
  78.  
  79. 0A7H -  VidLine, draws line of given pattern and color from 
  80.         (x1,y1) to (x2,y2).
  81.  
  82. 0A8H -  VidPolyFill, draw and fill polygon defined by a set of
  83.         vertices.
  84.  
  85. 0A9H -  VidBlit, does bitblit from source to destination. Both source
  86.         and destination can be anywhere in memory.
  87.  
  88. 0AAH thru 0B2H - Currently they do an immediate interrupt return when called.
  89.                  Reserved for future use.
  90.  
  91.  
  92. Description of Function Parameters:
  93.  
  94. -------------------------------------------------------------------------------
  95. ; VidID:
  96. ;
  97. ; Identifies the current version number of XGRAPH routines. It will always be
  98. ; a number between 01.00 and 99.99.
  99. ;
  100. ; Inputs - AH = 0A3H
  101. ;
  102. ; Outputs- BH = Major version number.
  103. ;          BL = Minor version number.
  104. ;
  105. ; Registers Altered: BX
  106. -------------------------------------------------------------------------------
  107.  
  108. -------------------------------------------------------------------------------
  109. ; VidInit:
  110. ;
  111. ; Looks at the current video mode and initializes internal variables. It
  112. ; returns to the user a pointer to the raster data found.
  113. ;
  114. ; Inputs - AH = 0A4H
  115. ;
  116. ; Outputs- ES:DI - Pointer to video description area see VidStruc data
  117. ;                  structure below.
  118. ;
  119. ; Registers Altered: ES, DI.
  120. ;
  121. ; Description of data structured returned in ES:DI (The values shown are
  122. ; in the case of IBM-CGA mode 4, 320x200 four colors:
  123. ;
  124. ; VidStruc      struc            
  125. ; GrfDestination        dd      0B800:0H ; Address of graphic raster.
  126. ; GrfRasterWidth        dw      80       ; Width of raster in bytes.
  127. ;
  128. ; GrfMinX               dw      0        ; Next four words define the
  129. ; GrfMinY               dw      0        ; size of raster in bits (Not Pixels!).
  130. ; GrfMaxX               dw      639
  131. ; GrfMaxY               dw      199
  132. ;
  133. ; GrfRowMask            db      1        ; variables to handle raster interleave
  134. ; GrfShiftInterleave    db      1
  135. ; GrfHomeOffset         dw      2000H
  136. ; GrfBankOffset         dw      2000H
  137. ;
  138. ; GrfPixelsPerByte      db      2      ; Variable to handle more that a pixel
  139. ;                                      ; per byte. Equals Log2(pixels per byte)
  140. ;       
  141. ; GrfTextAddr           dd      ????:????       ; Address of Xgraph's built-in
  142. ;                                               ; 16 patterns.
  143. ; GrfFontAddr           dd      ????:????       ; Address of Xgraph's built-in
  144. ;                                               ; 8x8 font.
  145. ; GrfFont2Addr          dd      ????:????       ; Address of Xgraph's built-in
  146. ;                                               ; 8x14 font.
  147. ; VidStruc              ends
  148. ;
  149. ; Where:
  150. ;
  151. ; GrfFontAddr and GrfFont2Addr are pointers to the built-in character font
  152. ; descriptors and have the following format:
  153. ;
  154. ; FontStruc     struc
  155. ;               dd      ????:????       ; Address of strike font rectangle
  156. ;               dw      256             ; width of font in bytes
  157. ;               dw      0               ; MinX
  158. ;               dw      0               ; MinY
  159. ;               dw      2047            ; MaxX
  160. ;               dw      7 or 13         ; MaxY
  161. ;               dw      8               ; Individual character width
  162. ;               dw      8 or 14         ; Individual character height
  163. ; FontStruc     ends
  164. ;
  165. ; See the procedure WriteChar in Xgraph.pas file for an example of how to
  166. ; write characters using built-in font and VidBitBlit.
  167. ;
  168. ; GrfTextAddr is a pointer to the built-in patterns. There are 16 patterns
  169. ; of sixteen words each stored in order. The following is a short description
  170. ; of them:
  171. ;
  172. ; 0) 1/2 Gray, every other dot on.      1) 2/4 Gray, every two dots on.
  173. ; 2) 4/8 Gray, every four dots on.      3) Left to right diagonal lines.
  174. ; 4) Right to left diagonal lines.      5) Horizontal lines.
  175. ; 6) Vertical lines.                    7) Brocade 1.
  176. ; 8) Square weave.                      9) Brocade 2.
  177. ; 10) Crosses and Naughts.              11) Triangular pattern.
  178. ; 12) Circular pattern.                 13) Braides.
  179. ; 14) Fancy Bricks.                     15) Wizards.
  180. ;
  181. ; Execute the Weaver.pas program to see patterns.
  182. -------------------------------------------------------------------------------
  183.  
  184. -------------------------------------------------------------------------------
  185. ; VidClear:
  186. ;
  187. ; Clears the current video screen independant of adapter and mode. All the
  188. ; bits inside the rectangle (MinX,MinY) to (MaxX,MaxY) are set to 0. This
  189. ; function is faster than VidRectFill or VidBitBlit because it uses STOSW
  190. ; instruction.
  191. ;
  192. ; Inputs - AH = 0A5H
  193. ;
  194. ; Outputs- None
  195. ;
  196. ; Registers Altered: None
  197. -------------------------------------------------------------------------------
  198.  
  199. -------------------------------------------------------------------------------
  200. ; VidRectFill:
  201. ;
  202. ; Fill a rectangular region (bit aligned) with the 16x16 pattern passed to the
  203. ; function. This function is faster than VidBitBlit because it uses the MOVSW
  204. ; instruction.
  205. ;
  206. ; Inputs - AH = 0A6H, VideoRectFill function
  207. ;          AL = EGA Map Mask register value.
  208. ;          CX = X pixel coordinate of upper left hand side.
  209. ;          DX = Y pixel coordinate of upper left hand side.
  210. ;          SI = X pixel coordinate of lower right hand side.
  211. ;          DI = Y pixel coordinate of lower right hand side.
  212. ;          ES:BX = Pointer to 16 word pattern to be used for filling.
  213. ;
  214. ; Registers Altered: None
  215. -------------------------------------------------------------------------------
  216.  
  217. -------------------------------------------------------------------------------
  218. ; VideoLine:
  219. ;
  220. ; Draws a line from (x1,y1) to (x2,y2) using the given color and line pattern.
  221. ; No clipping is done.
  222. ;
  223. ; Inputs - AH = 0A7H, VidLine function
  224. ;          AL = Color to draw line: 
  225. ;               Bit 0..2 Pattern select
  226. ;               Bit 3..6 EGA Map Mask register values.
  227. ;               Bit 7    =1 Xor mode, =0 Plot mode.
  228. ;          CX = X1
  229. ;          DX = Y1
  230. ;          SI = X2
  231. ;          DI = Y2
  232. ;
  233. ; Registers Altered: None
  234. ;
  235. ; Where:
  236. ;
  237. ; Pattern select (AL[0:2]) is used to select 1 out of 8 line patterns:
  238. ;
  239. ;   0) 1111111111111111    1) 1100110011001100    2) 1111000011110000
  240. ;   3) 0110011111100110    4) 0101010101010101    5) 1010101010101010
  241. ;   6) 1110111011101110    7) 0000000000000000
  242. ;
  243. ; EGA Color select (AL[3:6]) is used to select what color planes are enabled
  244. ; if the adapter is an EGA type. This value should be '1111' for all others.
  245. ; Xor mode (AL[7]) selects the type of operation to be performed when drawing
  246. ; the line. If this bit is zero the line pattern is or'ed to the screen. If bit
  247. ; if 1 the line pattern is xor'ed to with the screen.
  248. ;
  249. ; (X1,Y1) and (X2,Y2) are the starting and ending pixel coordinates of line.
  250. ; No clipping is done so both coordinates must be in the range (MinX,MinY) and
  251. ; (MaxX,MaxY) as returned in the VidStruc structure. 
  252. -------------------------------------------------------------------------------
  253.  
  254. -------------------------------------------------------------------------------
  255. ; VidPolyFill:
  256. ;
  257. ; If polygon fill is enabled fills the area bounded by the supplied vertices.
  258. ; And if border draw is enabled draws the set of lines between the vertices.
  259. ; No clipping is done.
  260. ;
  261. ; Inputs - AH = 0A8H, VidPolyLine function
  262. ;          AL = Color to draw line (same definition as VideoLine): 
  263. ;               Bit 0..2 Pattern select
  264. ;               Bit 3..6 EGA Map Mask register value when drawing lines.
  265. ;               Bit 7    Xor mode.
  266. ;          CL = EGA Map Mask register value used when filling.
  267. ;          CH = PolyType:
  268. ;                 Bit 0: Polygon fill,
  269. ;                               0 = Do not fill polygon.
  270. ;                               1 = Fill polygon with supplied pattern and
  271. ;                                   draw lines between vertices.
  272. ;                 Bit 1: Vertex data type,
  273. ;                               0 = Each vertex is an absolute screen coordinate
  274. ;                               1 = The first vertex is the location of polygon.
  275. ;                                   Each vertex after that is relative to last  
  276. ;                                   point plotted.
  277. ;                 Bit 2: Border draw,
  278. ;                               0 = Draw the polygon border after filling poly.
  279. ;                               1 = Do not draw border.
  280. ;                 Bits 3 thru 7 are reserved and should be zero.
  281. ;          DS:SI = Pointer to vertex list with the following format:
  282. ;               word, word, word, word, word, ... word, word = 2*N + 1 words
  283. ;               (N ), (X1), (Y1), (X2), (Y2),     (Xn), (Yn)
  284. ;
  285. ;               N = Total number of vertices in polygon (1 < N < 16383).
  286. ;
  287. ;               Xi or Yi coordinates should be positive screen coordinates if
  288. ;               in absolute mode (0 <= Xi <= 32767, 0 <= Yi <= 32767). Or
  289. ;               a 16 bit 2's complement integer if the coordinate is relative.
  290. ;               Remember that the first coordinate (X1, Y1) is always an
  291. ;               absolute number since it gives the location of the polygon.
  292. ;
  293. ;               Currently no clipping is performed on the vectors so be careful
  294. ;               the polygon fits inside the screen.
  295. ;
  296. ;       ES:BX = Pointer to user supplied polygon pattern.
  297. ;
  298. ; Registers Altered: None
  299. -------------------------------------------------------------------------------
  300.  
  301.  
  302. -------------------------------------------------------------------------------
  303. ; VidBlit:
  304. ;
  305. ; Perform a bitblit from the given source and texture to the destination
  306. ; rectangle with clipping. This function is slower than VidClear or VidRectFill
  307. ; because it uses the MOVSB instruction.
  308. ;
  309. ; Inputs - AH = 0A9H, VideoBlit function
  310. ;          BL = EGA Map Mask Register value (0..16).
  311. ;          BH = EGA Read Map Select register value (1..4).
  312. ;          DS:SI = Pointer to blit parameter. See BlitParm structure.
  313. ;
  314. ; Registers Altered: None.
  315. ;
  316. ; Where:
  317. ;
  318. ; BX is only needed when using an EGA specific video mode. BL selects what
  319. ; EGA color planes will get data if the screen is the destination rectangle.
  320. ; BH selects what EGA plane will be read if the screen is the source rectangle.
  321. ; If nonEGA video mode BX should equal 010FH.
  322. ;
  323. ; DS:SI points to the following data structure:
  324. ;
  325. ; BlitParm      struc
  326. ; Dest          dd      ?       ; Address of destination raster structure.
  327. ; Source        dd      ?       ; Address of source raster structure.
  328. ; Texture       dd      ?       ; Address of 16 word pattern.
  329. ; RectOrigenX   dw      ?       ; Origen of destination rectangle in 
  330. ; RectOrigenY   dw      ?       ; bit coordinates.                     
  331. ; RectCornerX   dw      ?       ; Corner of destination rectangle in
  332. ; RectCornerY   dw      ?       ; bit coordinates.
  333. ; PointX        dw      ?       ; Position in source where the rectangle
  334. ; PointY        dw      ?       ; will be moved from.
  335. ; Opcode        dw      ?       ; Blit operation between source and destination.
  336. ; TextOp        dw      ?       ; Texture operation between source and pattern.
  337. ; BlitParm      ends
  338. ;
  339. ; The complete blit operation consists of three steps:                 
  340. ;
  341. ; 1) Clip source and destination rectangles.
  342. ;
  343. ; 2) Merge source and pattern based on the TextOp:
  344. ;    0) R= 0,           1) R= 1,             2) R= S,            3) R= P,
  345. ;    4) R= S or P,      5) R= S and P,       6) R= S xor P,      7) R= Not(P),
  346. ;    8) R= S or Not(P), 9) R= S and Not(P), 10) R= S xor Not(P),
  347. ;    11 thru 15) Not used.
  348. ;
  349. ; 3) Merge the result of step 2 with the destination rectangle base on the
  350. ;    Opcode:
  351. ;    0) D= 0,             1) D= R and D,      2) D= R and Not(D),  3) D= R,
  352. ;    4) D= Not(R) and D,  5) D= D,            6) D= R xor D,       7) D= R or D,
  353. ;    8) D= Not(R) and Not(D),                 9) D= Not(R) xor D,
  354. ;   10) D= Not(D),       11) D= R or Not(D), 12) Not(R),
  355. ;   13) D= Not(R) or D,  14) D= Not(R) or Not(D),                 15) D= 1.
  356. ;
  357. ; The raster structures have the following data:
  358. ;
  359. ; Raster        struc
  360. ; Address       dd      ?       ; Address of the raster rectangle
  361. ; Width         dw      ?       ; width in bytes of each row.
  362. ; OrigenX       dw      ?       ; active rectangle within raster.
  363. ; OrigenY       dw      ?       ; (OrigenX,OrigenY) is the upper left corner.
  364. ; CornerX       dw      ?       ; (CornerX,CornerY) is the lower right corner.
  365. ; CornerY       dw      ?
  366. ; Raster        ends
  367. ;
  368. ; Note that the first 7 words of the VidStruc structure is a raster structure
  369. ; for the whole video screen. This can be used to blit to/from the screen.
  370. -------------------------------------------------------------------------------
  371.